package com.estronger.shopmanage.bean.batch;

import com.estronger.shopmanage.utils.ConvertUtils;

import java.util.ArrayList;

/**
 * author : DC-DingYG
 * e-mail : dingyg012655@126.com
 * time : 2020/09/17
 * desc : *
 */
public class BatchPgGoodsItem {
    //共用
    public String goodscode;//商品代号
    public String goodsname;//产品名称
    public String simplepicfile;//产品图片
    public String unitname;
    public String qty = "1";//数量
    public String sizedesc;//规格描述
    public ArrayList<GoodsCondition> conditionitem;//条件
    //测量的商品
    public String measureitemid;
    public boolean isShowCondition = true;
    //送货的商品
    private String dlvitemid = "0";//12,//送货细表ID
    private String goodsid = "0";//"13",//商品id
    //安装的商品

    public String getGoodscode() {
        return goodscode;
    }

    public void setGoodscode(String goodscode) {
        this.goodscode = goodscode;
    }

    public String getGoodsname() {
        return ConvertUtils.formatNull(goodsname);
    }

    public void setGoodsname(String goodsname) {
        this.goodsname = goodsname;
    }

    public String getSimplepicfile() {
        return simplepicfile == null ? "" : simplepicfile;
    }

    public void setSimplepicfile(String simplepicfile) {
        this.simplepicfile = simplepicfile;
    }

    public String getUnitname() {
        return ConvertUtils.formatNull(unitname);
    }

    public void setUnitname(String unitname) {
        this.unitname = unitname;
    }

    public String getQty() {
        return qty == null ? "1" : qty;
    }

    public void setQty(String qty) {
        this.qty = qty;
    }

    public String getSizedesc() {
        return ConvertUtils.formatNull(sizedesc);
    }

    public void setSizedesc(String sizedesc) {
        this.sizedesc = sizedesc;
    }

    public ArrayList<GoodsCondition> getConditionitem() {
        return conditionitem == null ? new ArrayList<GoodsCondition>() : conditionitem;
    }

    public void setConditionitem(ArrayList<GoodsCondition> conditionitem) {
        this.conditionitem = conditionitem;
    }

    public String getMeasureitemid() {
        return measureitemid == null ? "" : measureitemid;
    }

    public void setMeasureitemid(String measureitemid) {
        this.measureitemid = measureitemid;
    }

    public boolean isShowCondition() {
        return isShowCondition;
    }

    public void setShowCondition(boolean showCondition) {
        isShowCondition = showCondition;
    }

    public String getDlvitemid() {
        if(dlvitemid == null || dlvitemid.equals("")){
            dlvitemid = getMeasureitemid();
        }
        return dlvitemid;
    }

    public void setDlvitemid(String dlvitemid) {
        this.dlvitemid = dlvitemid;
    }

    public String getGoodsid() {
        return goodsid;
    }

    public void setGoodsid(String goodsid) {
        this.goodsid = goodsid;
    }

    //测量条件、安装条件
    public static class GoodsCondition{
        public String itemid;
        public String summary;
        public String content;
        public String ifcheck = "0";

        public String getItemid() {
            return itemid == null ? "" : itemid;
        }

        public void setItemid(String itemid) {
            this.itemid = itemid;
        }

        public String getSummary() {
            return summary == null ? "" : summary;
        }

        public void setSummary(String summary) {
            this.summary = summary;
        }

        public String getContent() {
            return content == null ? "" : content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        public String getIfcheck() {
            return ifcheck;
        }

        public void setIfcheck(String ifcheck) {
            this.ifcheck = ifcheck;
        }
    }

    //条件标题
    public String getContionTitle(int datatype){
        if(datatype == 1){
            return "测量条件";
        }else if(datatype == 2){
            return "送货条件";
        }else if(datatype == 3){
            return "安装条件";
        }else {
            return "条件";
        }
    }

}
